unit globals;

interface
        uses Contnrs, KernelUnit, PBCheckLB, StdCtrls, passUnit;

var
        WN_DataList : TObjectList;
        Resources_DataList : TObjectList;
        sbDomainsList : TObjectList;
        cBuffersList : TObjectList;
        texturesList : TObjectList;
        KernelList   : TObjectList;
        passList   : TObjectList;

        const WORK_NODE_TYPE = 1;
        const PASS_TYPE      = 2;
        const RESOURCE_TYPE  = 3;

        const SUBDOMAIN_MODE = 1001;
        const CONSTBUFFER_MODE = 1002;
        const TEXTURE_MODE = 1003;


procedure doInitialise();
procedure removeItem(list : TPBCheckListBox; index : Integer);
function countChecked(list : TPBCheckListBox; var lastChecked : String):Integer;

implementation

procedure doInitialise();
begin
WN_DataList := TObjectList.Create;
Resources_DataList := TObjectList.Create;
sbDomainsList := TObjectList.Create;
cBuffersList := TObjectList.Create;
texturesList := TObjectList.Create;
KernelList   := TObjectList.Create;
passList   := TObjectList.Create;
end;

procedure removeItem(list : TPBCheckListBox; index : Integer);
begin
if index >= list.Items.Count then
  exit;
if list.State[index] = cbchecked then
  list.Items.Delete(index)
else inc(index);
removeItem(list, index);
end;

function countChecked(list : TPBCheckListBox; var lastChecked : String):Integer;
var
  i : Integer;
  r : Integer;
begin
  r := 0;
  for i:=0 to list.Count-1 do
    begin
      if list.State[i] = cbchecked then
        begin
          Inc(r);
          lastChecked := list.Items.Strings[i];
        end;
    end;
  result := r;
end;

end.
